import React, { PureComponent } from 'react';

import { NoDataMaskC } from '../../../../comps';
import style from '../index.less';

class FundInfo extends PureComponent {
  constructor() {
    super();
    this.state = {
      currentUser: {}, // 当前登录用户信息
    };
  }

  fundNatureRender = (params) => {
    const par = typeof params === 'string' ? Number(params) : 0;
    switch (par) {
      case 150:
        return '证券投资基金';
      case 160:
        return 'ETF';
      case 170:
        return 'FOF';
      case 180:
        return 'LOF';
      case 190:
        return '联接基金';
      default:
        return '--';
    }
  };

  // 展示内容
  showContent = () => {
    const { info, fundType } = this.props;
    return (
      <div className={style.fundInfo} style={{ position: 'relative' }}>
        <div>
          <div className={style.everyLine}>
            <div>日期：</div>
            <div>{`${info && info.startdate ? info.startdate : '--'}`}</div>
          </div>
          <div className={style.everyLine}>
            <div>单位净值：</div>
            <div>{`${info && info.netValue ? info.netValue : '--'}`}</div>
          </div>
          <div className={style.everyLine}>
            <div>累计净值：</div>
            <div>{`${info && info.accuNetValue ? info.accuNetValue : '--'}`}</div>
          </div>
          <div className={style.everyLine}>
            <div>基金全称：</div>
            <div>{`${info && info.chiname ? info.chiname : '--'}`}</div>
          </div>
          <div className={style.everyLine}>
            <div>基金管理人：</div>
            <div>{`${info && info.managementcom ? info.managementcom : '--'}`}</div>
          </div>
          <div className={style.everyLine}>
            <div>基金托管人：</div>
            <div>{`${info && info.jjtgr ? info.jjtgr : '--'}`}</div>
          </div>
          {fundType == '1' ? null : (
            <div className={style.everyLine}>
              <div>证券类别：</div>
              <div>{`${info && info.secType ? info.secType : '--'}`}</div>
            </div>
          )}

          {fundType == '1' ? null : (
            <div className={style.everyLine}>
              <div>基金性质：</div>
              <div>{`${info && info.fundNature ? this.fundNatureRender(info.fundNature) : '--'}`}</div>
            </div>
          )}

          {/* 私募 1  */}
          {fundType == '1' ? (
            <>
              <div className={style.everyLine}>
                <div>一级投资策略：</div>
                <div>{`${info && info.investStrategyI ? info.investStrategyI : '--'}`}</div>
              </div>
              <div className={style.everyLine}>
                <div>二级投资策略：</div>
                <div>{`${info && info.investStrategyII ? info.investStrategyII : '--'}`}</div>
              </div>
            </>
          ) : null}

          {/* <div className={style.everyLine}> */}
          {/*   <div>投资范围：</div> */}
          {/*   <div>{`${info && info.invscope ? info.invscope : '--'}`}</div> */}
          {/* </div> */}
        </div>
        {info !== undefined ? null : <NoDataMaskC height='100%' title='请选择基金代码，加载数据' />}
      </div>
    );
  };

  render() {
    return <div>{this.showContent()}</div>;
  }
}

export default FundInfo;
